from google.appengine.ext import db
from com.jumang.model.NoteCategory import NoteCategory
from com.jumang.model.Location import JumLocation

class note(db.Model):
    title=db.StringProperty(required=True)
    isPublic=db.BooleanProperty()
    content=db.TextProperty(required=True)
    createTime=db.DateTimeProperty(auto_now_add=True)
    reference=db.StringProperty()
    refResult=db.StringProperty()
    jumCategory=db.ReferenceProperty(NoteCategory)  
    jumLocation=db.ReferenceProperty(JumLocation) 
    def locations(self):
        myLocations=u''
        myLocation=self.jumLocation
        while myLocation:
            myLocations=myLocation.name+myLocations
            myLocation=myLocation.area
        return myLocations
    def get_absolute_url(self) :
        return '/main/note/?id=%s/'%self.key().id()
    
    
        
        
